package org.example.demo;

import java.util.Random;

/*
*  随机抽奖,不重复.  2元,888元, 1000元
* 
* */
public class Test3 {
    public static void  main(String[] args){
        int[] arr =  { 2,888,100 };
        int indexArr = 0;
        daluan(arr);
        int  res1 =   getOne(arr,indexArr);
        indexArr++;
        int  res2 =   getOne(arr,indexArr);
        indexArr++;
        int  res3 =   getOne(arr,indexArr);

        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }

        System.out.println(res1);
        System.out.println(res2);
        System.out.println(res3);
    }
    public static void daluan(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            int cacheI =  arr[i];
            int ran = new Random().nextInt(arr.length);
            arr[i] = arr[ran];
            arr[ran] = cacheI;
        }
    }
    public static int getOne(int[] arr ,int index){
        return  arr[index++];
    }
}